package com.example.oop;

import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.InvocationTargetException;

/**
 * @author houyangfan
 * @version 1.0
 * @date 2022/8/2 15:12
 */
@Slf4j
public class ReflectionIssue {

    private void age(int age) {
        log.info("int age = {}", age);
    }

    private void age(Integer age) {
        log.info("Integer age = {}", age);
    }

    public void testReflect(){
        try {
            ReflectionIssue.class.getDeclaredMethod("age", Integer.TYPE).invoke(this, Integer.valueOf("36"));
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new ReflectionIssue().testReflect();
    }
}
